<template>
  <div>
    <!-- 搜索要查询的内容 -->
    <el-row>
      <el-col :span="6">
        <el-input
          placeholder="请输入要搜索的内容"
          size="small"
          v-model="input"
          suffix-icon="el-icon-search"
          clearable>
        </el-input>
      </el-col>
      <el-col :span="2">
        <el-button type="primary" size="small" @click="search">搜索</el-button>
      </el-col>
    </el-row>
    <!-- 表格内容 -->
    <el-row class="table">
      <el-col :span="24">
        <el-table
          :data="tableData"
          border
          show-header
          style="width: 100%">
          <el-table-column
            align="center"
            prop="id"
            :label="headerTable.id"
            width="180">
            <template slot-scope="scope">皇字第{{ scope.row.id }}号</template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="name"
            :label="headerTable.name"
            width="180">
          </el-table-column>
          <el-table-column
            align="center"
            prop="ghost"
            :label="headerTable.ghost">
          </el-table-column>
          <el-table-column
            align="center"
            prop="time"
            :label="headerTable.time">
          </el-table-column>
          <el-table-column
            align="center"
            prop="reason"
            :label="headerTable.reason">
          </el-table-column>
          <el-table-column
            align="center"
            prop="admin"
            :label="headerTable.admin">
          </el-table-column>
          <el-table-column
            align="center"
            prop="siteTime"
            :label="headerTable.siteTime">
          </el-table-column>
        </el-table>
      </el-col>
    </el-row>
    <!-- 分页 -->
    <el-row>
      <el-col :span="24" class="pagination">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage4"
          :page-sizes="[100, 200, 300, 400]"
          :page-size="100"
          layout="total, sizes, prev, pager, next, jumper"
          :total="400">
        </el-pagination>
      </el-col>
    </el-row>
  </div>
</template>
<script>
export default {
  name: 'auditTable',
  props: {
    tableData: {
      type: Array,
      default: () => []
    },
    headerTable: {
      type: Object,
      default: () => {}
    }
  },
  data () {
    return {
      input: '',
      currentPage4: 4
    }
  },
  methods: {
    search () {
      this.$emit('searchList', this.input)
    },
    handleSizeChange (val) {
      console.log(`每页 ${val} 条`)
    },
    handleCurrentChange (val) {
      console.log(`当前页: ${val}`)
    }
  }
}
</script>
<style lang="less" scoped>
.table {
  margin: 10px 0;
}
.pagination {
  text-align: right;
}
</style>
